package com.cloudjan.springcloud.controller;

import com.cloudjan.springcloud.entities.CommonResult;
import com.cloudjan.springcloud.entities.Payment;
import com.cloudjan.springcloud.service.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 基于openFeign的方式调用服务
 */
@RestController
public class OrderFeignController {
    @Autowired
    private OrderFeignService orderFeignService;

    @GetMapping(value = "/comsumer/payment/get/{id}")
    public CommonResult<Payment> get(@PathVariable("id") Long id){
        return orderFeignService.get(id);
    }

    @GetMapping("/comsumer/payment/feign/timeout")
    public String paymentFeignTimeout(){
        return  orderFeignService.paymentFeignTimeout();
    }
}
